#version=RHEL8

# Do not use graphical install
text

# Keyboard layouts
keyboard --xlayouts='us'
# System language
lang en_US.UTF-8

# Partition clearing information
clearpart --all --drives={{ hostvars[item]['disk'] }}
# Partitioning
ignoredisk --only-use={{ hostvars[item]['disk'] }}
partition /boot/efi --fstype=vfat --size=512
partition / --fstype=ext4 --size=65536

# Network information
network --bootproto=static --device={{ hostvars[item]['network_interface'] }} --ip={{ hostvars[item]['ansible_host'] }} --gateway={{ ansible_default_ipv4.gateway }} --nameserver={{ dns_server }} --netmask={{ ansible_default_ipv4.netmask }} --ipv6=auto --hostname={{ hostvars[item]['inventory_hostname'] }} --activate

# Use network installation
repo --name="Repository" --baseurl=http://{{ ansible_default_ipv4.address }}/os
url --url="http://{{ ansible_default_ipv4.address }}/os"
# Disable Setup Agent on first boot
firstboot --disable
# Do not configure the X Window System
skipx
# Enable NTP
services --enabled="chronyd"
# System timezone
timezone {{ timezone }} --utc

# Create user (locked by default)
user --groups=wheel --name=admin
# Add SSH key
sshkey --username=root "{{ ssh_public_key }}"
# Disable root password login
rootpw --lock

# Disable SELinux
selinux --disabled

# Disable firewall
firewall --disabled

%packages
@^custom-environment
openssh-server
%end

# Create a raw partition for Ceph using the remaining space
# Using a post script because there is no built-in feature in Kickstart
# The three empty lines are equivalent to pressing Enter to use the default values for:
# - Partition number
# - First sector
# - Last sector
%post
fdisk /dev/{{ hostvars[item]['disk'] }} << EOF
new



write
EOF
%end

reboot
